FIND_PATH(PHYSX3_INCLUDE_DIR PxPhysics.h)
FIND_PATH(PHYSX3_LIBRARY_DIR PhysX3Extensions.lib)

FIND_LIBRARY(PHYSX3_LIBRARY NAMES PhysX3_x86 PhysX3_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_COMMON_LIBRARY NAMES PhysX3Common_x86 PhysX3Common_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_COOKING_LIBRARY NAMES PhysX3Cooking_x86 PhysX3Cooking_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_EXT_LIBRARY NAMES PhysX3Extensions PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_VEHICLE_LIBRARY NAMES PhysX3Vehicle PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_TASK_LIBRARY NAMES PxTask PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_PVD_LIBRARY NAMES PhysXVisualDebuggerSDK PATHS ${PHYSX3_LIBRARY_DIR})

FIND_LIBRARY(PHYSX3_LIBRARY_DEBUG NAMES PhysX3CHECKED_x86 PhysX3CHECKED_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_COMMON_LIBRARY_DEBUG NAMES PhysX3CommonCHECKED_x86 PhysX3CommonCHECKED_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_COOKING_LIBRARY_DEBUG NAMES PhysX3CookingCHECKED_x86 PhysX3CookingCHECKED_x64 PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_EXT_LIBRARY_DEBUG NAMES PhysX3ExtensionsCHECKED PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_VEHICLE_LIBRARY_DEBUG NAMES PhysX3VehicleCHECKED PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_TASK_LIBRARY_DEBUG NAMES PxTaskCHECKED PATHS ${PHYSX3_LIBRARY_DIR})
FIND_LIBRARY(PHYSX3_PVD_LIBRARY_DEBUG NAMES PhysXVisualDebuggerSDKCHECKED PATHS ${PHYSX3_LIBRARY_DIR})

IF(PHYSX3_INCLUDE_DIR AND PHYSX3_LIBRARY)
    SET(EXTERNAL_INCLUDE_DIR ${PHYSX3_INCLUDE_DIR} ${PHYSX3_INCLUDE_DIR}/foundation)
    SET(EXTERNAL_LIBRARIES
        debug ${PHYSX3_LIBRARY_DEBUG}           optimized ${PHYSX3_LIBRARY}
        debug ${PHYSX3_COMMON_LIBRARY_DEBUG}    optimized ${PHYSX3_COMMON_LIBRARY}
        debug ${PHYSX3_COOKING_LIBRARY_DEBUG}   optimized ${PHYSX3_COOKING_LIBRARY}
        debug ${PHYSX3_EXT_LIBRARY_DEBUG}       optimized ${PHYSX3_EXT_LIBRARY}
        debug ${PHYSX3_VEHICLE_LIBRARY_DEBUG}   optimized ${PHYSX3_VEHICLE_LIBRARY}
        debug ${PHYSX3_TASK_LIBRARY_DEBUG}      optimized ${PHYSX3_TASK_LIBRARY}
        debug ${PHYSX3_PVD_LIBRARY_DEBUG}       optimized ${PHYSX3_PVD_LIBRARY}
    )
    
    SET(EXAMPLE_NAME osgphysx3)
    SET(EXAMPLE_FILES osgphysx3.cpp PhysXInterface.cpp PxTkStream.cpp SampleCloth.cpp)
    START_EXAMPLE()
ENDIF(PHYSX3_INCLUDE_DIR AND PHYSX3_LIBRARY)
